﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>无标题页</title>

	<link href="Themes/Default/Form.css" rel="stylesheet" type="text/css" />
	
	<script src="Core/Common.js" type="text/javascript"></script>

	<script src="Core/Extent.js" type="text/javascript"></script>

	<script src="Core/Sub.js" type="text/javascript"></script>
	
	<style type="text/css">
	.item
	{
		margin: 1px;
		padding: 4px;
		height: 16px;
		font-size: 12px;
		cursor: pointer;
		border: 0px solid #316AC5;
		white-space:nowrap;
	}
	.item_hover
	{
		margin: 1px;
		padding: 3px;
		height: 16px;
		font-size: 12px;
		cursor: pointer;
		border: 1px solid #316AC5;
		background-color: #C6D6EF;
		white-space:nowrap;
	}
	.headImg
	{
		float: left;
		width: 16px;
		height: 16px;
	}
	.nickname
	{
		float: left;
		width: 130px;
		padding-left: 4px;
		line-height:16px;  
		overflow: hidden;
	}
	.count
	{
		float: right;
		padding-left: 4px;
		line-height:16px; 
		color: #880000; 
	}
	#ope
	{
		text-align: right;
		padding: 8px 6px 6px 6px;
	}
	#ope a
	{
		text-decoration: none;
		color: Blue;
		margin-left: 3px;
	}
	#ope a:hover
	{
		text-decoration: underline;
		color: #AA0000; 
	}
	</style>
	
	<script language="javascript" type="text/javascript">
	
	window.OpenFirst = function()
	{
		var dom_items = document.getElementById("items");
		if(dom_items.firstChild != null) Core.UnreadMsgBoxImpl.Open(dom_items.firstChild.User.ID);
	}
	
	window.Refresh = function()
	{
		var dom_items = document.getElementById("items");
		dom_items.innerHTML = "";

		var users = Core.UnreadMsgBoxImpl.GetRelativeUsers();
		for (var i in users)
		{
			var u = users[i];
			var item_html = String.format(
				"<img class='headImg' src='{0}'/><div class='nickname' nowrap>{1}({2})</div><div class='count'>({3})</div>",
				u.Type == 0 ? Core.CreateHeadImgUrl(u.Name, 16, false, u.HeadIMG) : Core.CreateGroupImgUrl(u.Name, u.IsTemp),
				u.Nickname, u.Name, Core.UnreadMsgBoxImpl.GetUnreadMsgCountOfUser(u.ID)
			);
			var dom = document.createElement("DIV");
			dom.className = "item";
			Core.Utility.AttachButtonEvent(dom, "item", "item_hover", "item_hover");
			dom.innerHTML = item_html;
			dom.User = u;
			(function(dom_items, dom, u)
			{
				dom.onclick = function()
				{
					Core.UnreadMsgBoxImpl.Open(u.ID);
				}
			})(dom_items, dom, u);
			dom_items.appendChild(dom);
		}		
		var height = Math.max(document.body.offsetHeight, 10);
		if (Core.UnreadMsgBoxImpl.IsUnreadMsgBoxVisible())
		{
			CurrentWindow.MoveEx("LEFT|TOP", CurrentWindow.GetLeft(), CurrentWindow.GetTop() + (CurrentWindow.GetHeight() - 30 - height), true);
		}
		CurrentWindow.Resize(200 + 6 * 2, height + 18 + 6 * 2);
	}
	
	function ClearAll()
	{
		Core.UnreadMsgBoxImpl.Clear();
		Refresh();
		Core.UnreadMsgBoxImpl.HideUnreadMsgBox();
	}
	
	function init()
	{
		document.oncontextmenu = function() { return false; }
	}
	</script>
</head>
<body>
	<div id="items"></div>
	<div id="ope"><a href="javascript:ClearAll();">清空所有</a></div>
</body>
</html>
